// ignore_for_file: must_be_immutable, no_leading_underscores_for_local_identifiers, prefer_typing_uninitialized_variables
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:yt_devops/styles/styles.dart';

class SearchButton extends StatefulWidget {
  /// 站点状态
  int? status;
  String? keyword;
  String number;
  double? keywordFontSize;
  double? numberFontSize;
  FontWeight? keywordFontWeight;
  FontWeight? numberFontWeight;
  Color? backgroundColor;
  Color? keywordColor;
  Color? numberColor;
  Color? borderColor;
  double? borderWidth;
  double? width;
  double? height;
  double? radius;
  Function? onClickFatherWidgets;

  SearchButton({
    Key? key,
    required this.keyword,
    required this.status,
    required this.onClickFatherWidgets,
    this.number = "",
    this.backgroundColor = Colour.white,
    this.keywordColor = const Color(0xFF333333),
    this.numberColor = Colour.black,
    this.borderColor = Colour.black,
    this.keywordFontSize = 12,
    this.keywordFontWeight = FontWeight.normal,
    this.numberFontSize = 28,
    this.numberFontWeight = FontWeight.w500,
    this.borderWidth = 1,
    this.width = 98,
    this.height = 68,
    this.radius = 4,
  }) : super(key: key);

  @override
  State<SearchButton> createState() => _SearchButtonState();
}

class _SearchButtonState extends State<SearchButton> {
  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () async {
        widget.onClickFatherWidgets!(widget.status);
      },
      child: Container(

        width: widget.width!,
        height: widget.height!,
        decoration: BoxDecoration(
          color: widget.backgroundColor,
          // color: Colors.red,
          borderRadius: BorderRadius.all(
            Radius.circular(
              widget.radius!.sp,
            ),
          ),
          border: Border.all(
            color: widget.borderColor!,
            width: widget.borderWidth!.w,
          ),
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.start,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
             Container(
               // color: Colors.red,
                padding: EdgeInsets.only(top: 0),
                child: Text(
                  widget.number == "" ? "0" : widget.number,
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    color: widget.numberColor,
                    fontSize: widget.numberFontSize!.sp,
                    fontWeight: widget.numberFontWeight,
                    height: 1.4,
                    fontFamily: 'DIN',
                  ),
                ),
              ),

          Text(
                widget.keyword!,
                style: TextStyle(
                  color: widget.keywordColor,
                  fontSize: widget.keywordFontSize!.sp,
                  fontWeight: widget.keywordFontWeight,
                ),
              ),

          ],
        ),
      ),
    );
  }
}
